using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter11
{
	/// <summary>
	/// Example08: The Merry-Go-Round
	/// A horizontal platform in the shape of a circular disk
	/// rotates freely in a horizontal plane about a frictionless
	/// vertical axle. The platform has a mass M = 100 kg and a radius
	/// R = 2.0m. A student whose mass is m = 60 kg walks slowly from
	/// the rim of the disk toward its center. If the angular
	/// speed of the system is 2.0 rad/sec when the student is at
	/// the rim, what is the angular speed when he reaches a point
	/// r = 0.5 m from the center?
	/// w_f = 4.1 rad/sec
	/// </summary>
	public class Example08
	{
		public Example08()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass M = new L.Mass();
			M.kg = 100.0;
			L.Length R = new L.Length();
			R.m = 2.0;
			L.RigidBody disk = new L.RigidBody(M);
			disk.SetCylinder(R,R);
			L.MomentOfInertia Ii = new L.MomentOfInertia();
			Ii.ZZ = disk.RigidBodyMomentOfInertia.ZZ + 60.0*R.m*R.m;
			L.AngularVelocity wi = new L.AngularVelocity();
			wi.Z = 2.0;
			L.AngularMomentum Li = new L.AngularMomentum(Ii,wi);
			L.MomentOfInertia If = new L.MomentOfInertia();
			If.ZZ = disk.RigidBodyMomentOfInertia.ZZ + 60.0*0.5*0.5;
			L.AngularVelocity wf = new L.AngularVelocity();
			wf.Z = Li.Z / If.ZZ;

			result+=Convert.ToString(wf.Z);
		}
	}
}
